package org.groovyflow.util

/**
 * @see Decision
 *
 * @author Chuck Tassoni
 */
//@Typed
class Rule {
  def Closure pred
  def Closure action

  def Rule(Closure pred, Closure action) {
    this.pred = pred;
    this.action = action;
  }

  def eval(){
    new Decision().safe().apply(this)
  }


  public Rule setPredicateDelegate(Object obj) {
    pred.delegate = obj
    this
  }

  public Rule setActionDelegate(Object obj) {
    action.delegate = obj
    this
  }

  public Rule setDelegate(Object obj) {
    setPredicateDelegate(obj)
    setActionDelegate(obj)
    this
  }


}
